﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TinyForum.DataObjects;
using System.ServiceModel;
using Apworks.Repositories;

namespace TinyForum.Application
{
    [ServiceContract(Namespace = "http://www.tinyforum.com")]
    public interface IAccountApplication
    {
        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        long Register(AccountDataObject accountDataObject);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        bool AccountExists(string userName);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        bool Authenticate(string userName, string password);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        void GrantAdminPrivilege(string userName);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        IEnumerable<AccountDataObject> GetAccountsByUserName(string userName);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        IEnumerable<AccountDataObject> GetAccountsByEmail(string email);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        AccountDataObject GetAccount(long id);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        IEnumerable<AccountDataObject> GetAllAccounts();

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        string GetPassword(string userName, string passwordAnswer);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        bool ChangePassword(string userName, string oldPassword, string newPassword);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        bool ChangePasswordQuestionAndAnswer(string userName, string password, string newPasswordQuestion, string newPasswordAnswer);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        string ResetPassword(string userName, string answer);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        void Lock(string userName);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        void Unlock(string userName);

        [OperationContract]
        [FaultContract(typeof(ApplicationFaultDetail))]
        void UpdateInformation(string userName, string displayName, string email);
    }
}
